<?php
    echo "<h2> Web Statistic </h2>";
   
    $category[1] = 'All';
    $category[2] = 'Members';
    $category[3] = 'Jobs & Advs';
    $category[4] = 'Finance';
    
    $category2[1] = 'All';
    $category2[2] = 'Last Day';
    $category2[3] = 'Last Week';
    $category2[4] = 'Last Month';
    $category2[5] = 'Last 6 Months';
    $category2[6] = 'Last Year';
    
    echo "<form id='filter'>";
        echo "Category : ";
        echo $form->select('category',$category,null,array(),false);
        echo " &nbsp Period : ";
        echo $form->select('period',$category2,null,array(),false);
        echo " ";
        echo $ajax->submit('Report', array('div' => false, 'class' => 'submitbutton', 
                            'url' => array('controller'=> 'jobs','action' => 'web_filter'), 
                            'update' => 'slip','complete'=>"make_slip();")
                            );        
    echo "</form>";
    $baseurl = current(split("index", $_SERVER['SCRIPT_FILENAME']));  
    $file = $baseurl."count.txt";
    $size = filesize($file);
    $open = fopen($file, "r");
    $count = fread($open, $size);

    $expval = explode("*-*",$count);
    fclose($open);    
    
    echo " - Today : <b>".$expval[0]."</b> visitor(s)";
    echo "<br>";
    if($expval[2]!=0)
    echo " - Rate : <b>".round($expval[1]/$expval[2])."</b> visitor(s) / day";
    
    echo "<div id='slip'></div>";          
?>
